package com.it.controller;

import cn.dev33.satoken.util.SaResult;
import com.github.pagehelper.PageInfo;
import com.it.bean.OperationLog;
import com.it.page.PageImpl;
import com.it.page.PageQuery;
import com.it.service.OperationLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/operation/log")
public class OperationLogController {
    private final OperationLogService operationLogService;

    @PostMapping("/page")
    public SaResult page(@RequestBody PageQuery<OperationLog> pageQuery) {
        PageInfo<OperationLog> pageInfo = operationLogService.page(pageQuery);
        return SaResult.data(PageImpl.of(pageInfo));
    }
}